<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.lp.cfg.ProConfig"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/oss/iot/common/variable.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/variable_js.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/resource_lib.jsp"%>

<style type="text/css">
	.dashboard-menu{
		border-top:1px solid #ecf0f5;
	}
	.app-container{
		background:  #f2f2f2;width: 100%;border-top:1px solid #ecf0f5;
	}
	
	.box-white {
	    width: 97%;
	    min-width: 897px;
	    padding-bottom: 0;
	    margin: 0 auto;
	}
	.box {
	    padding: 10px;
	    padding-top:1px;
	    border-left: 1px solid #d2d6de;
	    border-right: 1px solid #d2d6de;
	    border-bottom: 1px solid #d2d6de;
	}
	.box {
	    border: 0!important;
	    box-shadow: 0 0 2px 1px rgba(13,5,9,.08)!important;
	}
	.box {
	    position: relative;
	    border-radius: 3px;
	    background: #fff;
	    border-top: 3px solid #d2d6de;
	    margin-bottom: 20px;
		width:800px;
		margin: 0 auto;
	    box-shadow: 0 1px 1px rgba(0,0,0,.1);
	}
	.sceneList-info{
		padding-top: 10px;
		padding-left: 10px;
	}
	.p-title{
		padding: 20px 0;
		font-size: 20px;
		margin-left: -50px;
	}
</style>
</head>
<body>
	<div>
		<div style="background: #ecf0f5;">
			<div class="mapContainer" >
				<div class="app-container">
					<div class="container-layout sceneList-info">
						<div class="box join-device-box">
							<div class="clearfix" style="width: 600px;margin: 0 auto;">
								<div>
									<p class="p-title">Add camera information</p>
								</div>
								<div id="modify-video"  config-option=" 'url':'/video','method':'put',
													  'submit':'.save-Btn',
													  'success':'sunccessReturn' ">
								<div id="add-video"  config-option=" url:'/video',
												   submit:'.save-Btn',
												   success:'sunccessReturn' ">
									<div id="detail_get" config-option=" 'url':'/video?id=$#init-id$' ">
										<input type="hidden" type-name="id" id="init-id" >
										<input type="hidden" type-name="scene_id"  class="scene_id">
										<div class="form-line">
											<span class="red">*</span>&nbsp;<span>Camera name:</span>
											<div class="pb-10 pt-10">
												<input placeholder="Enter camera name" validate="empty" type-name="name" class="input input-big" >
											</div>	
										</div>
										<div class="form-line">
											<span class="red">*</span>&nbsp;<span>Access Type:</span>
											<div class="pb-10 pt-10">
												<select type-name="video_type" validate="empty"  type-option="selecter" 
														config-option="'method':'GET','url':'/dictionary/78','key':'code','value':'name','init_value':'Please select an access type','type':'list' "  class="input input-big input-select" ></select>
											</div>	
										</div>
										<div class="form-line">
											<span class="red">*</span>&nbsp;<span>Project Name:</span>
											<div class="pb-10 pt-10">
												<input type-name="app_name" placeholder="Important character combinations such as lightmo" validate="empty" class="input input-big app_name" >
											</div>
										</div>
										<div class="form-line">
											<span class="red">*</span>&nbsp;<span>RTMP URL：</span>
											<div class="pb-10 pt-10">
												<input type-name="rtmp_url_common"  placeholder="rtmp url address" validate="empty" class="input input-big" >
											</div>
										</div>
										<div class="form-line">
											<span class="red">*</span>&nbsp;<span>HLS URL：</span>
											<div class="pb-10 pt-10">
												<input type-name="hls_url"  placeholder="m3u8 url address" validate="empty" class="input input-big" >
											</div>
										</div>
										<div class="form-line">
											<span>Sort in:</span>
											<div class="pb-10 pt-10">
												<input placeholder="Display sequence" type="number" value="1"  validate="empty"  type-name="seq" class="input input-big" >
											</div>	
										</div>
										<div class="form-line clearfix" style="padding-bottom: 20px;">
											<button onclick="returnBack()"  class="cancel-btn button ml-20  border-gray button-big float-right">Cancel</button>
											<button class="save-Btn button bg-iot ml-10 button-big float-right">Save</button>
										</div>
									</div>
								</div>
								</div>
							</div>
							
						</div>
						<div style="height: 40px;"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
function sunccessReturn(data){
	if(isOK(data)){
		forwardUrl("/iot/video_manager?id="+GetQueryString("id"),1000,"Save successfully");			
	}else{
		tip(data.statusMsg);
	}
}
function returnBack(){
	forwardUrl('/iot/video_manager?id='+GetQueryString("id"));
}
$(function(){
	// 初始化url参数
	var id = GetQueryString("id");
	$(".scene_id").val(id);
	
	var sid = GetQueryString("sid");
	if(validater.empty(sid)){
		manual_form_submit($("#add-video"))
	}else{
		$(".p-title").html("Edit camera information");
		writeVal("init-id",sid);
		manual_form_submit($("#modify-video"));
		setTimeout(function(){
			manual_init_detail_get($("#detail_get"));			
		}, 150);
	}
	
	$(".app_name").blur(function(){
// 		if( ! validater.empty( $(".app_name").val() )){
// 			gic("rtmp_url_common").val("rtmp://47.107.108.69/live/" + $(".app_name").val() );
// 			gic("hls_url").val("http://47.107.108.69:8080/live/"+$(".app_name").val()); 
// 		}
	});
	
})

</script>
</html>